namespace GUI.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Auteurs",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Lastname = c.String(),
                        Profil = c.String(),
                        Adressmail = c.String(),
                        UserProfileId = c.Int(nullable: false),
                        Userprofile_UserId = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.UserProfile", t => t.Userprofile_UserId)
                .Index(t => t.Userprofile_UserId);
            
            CreateTable(
                "dbo.UserProfile",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.Articles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Date_Creation = c.DateTime(nullable: false),
                        Sujet = c.String(),
                        Titre = c.String(),
                        Text_Article = c.String(),
                        AuteurId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Auteurs", t => t.AuteurId, cascadeDelete: true)
                .Index(t => t.AuteurId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Articles", new[] { "AuteurId" });
            DropIndex("dbo.Auteurs", new[] { "Userprofile_UserId" });
            DropForeignKey("dbo.Articles", "AuteurId", "dbo.Auteurs");
            DropForeignKey("dbo.Auteurs", "Userprofile_UserId", "dbo.UserProfile");
            DropTable("dbo.Articles");
            DropTable("dbo.UserProfile");
            DropTable("dbo.Auteurs");
        }
    }
}
